home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
c_lang
/
varinc.lzh
/
GET_ADDR.C
< prev
next >
Wrap
Text File
|
1979-11-30
|
3KB
|
63 lines
/* SOURCE FILE: GET_ADDR.C */
/*****************************************************************************/
/* get_addr() prompts for address data for order-entry programs. All data */
/* are returned to the caller by arguments 3-9 (yes, 9 is rather high). */
/*****************************************************************************/
#include <stddefs.h>
#include "projutil.h"
#include "ordentry.h"
stepcode get_addr(step_rtn, row, name, company,
street, street2, city, state, zip)
stepcode step_rtn; /* step_rtn is passed in and returned. */
short row; /* screen row to begin prompting */
char name[], company[], street[], street2[], city[], state[], zip[];
{
short step;
enum prompts {NAME, COMPANY, STREET, STREET2, CITY, STATE, ZIP, ENDSTEPS};
/* Begin at last prompt if screen backed into. */
step = (step_rtn == STEPOK) ? 0 : (short)ENDSTEPS - 1;
for (step_rtn = STEPOK; step_rtn != STEPCANC &&
(step != (short)ENDSTEPS) && (step >= 0); )
{
switch (step)
{
case NAME: /* Get name. */
step_rtn = prompt(name, "L", 3, L_SHIP_NAME, MAND, row, 30);
break;
case COMPANY: /* Get company name. */
step_rtn = prompt(company, "L", 3, L_SHIP_CMPY, OPT, row + 1, 30);
break;
case STREET: /* Get first line of street address. */
step_rtn = prompt(street, "L", 3, L_SHIP_STRT, MAND, row + 2, 30);
break;
case STREET2: /* Get second line of street address. */
step_rtn = prompt(street2, "L", 3, L_SHIP_STRT2, OPT, row + 3, 30);
break;
case CITY: /* Get city. */
step_rtn = prompt(city, "L", 2, L_SHIP_CITY, MAND, row + 4, 30);
break;
case STATE: /* Get state's two-letter abbreviation. */
step_rtn = prompt(state, "A", L_SHIP_STATE,
L_SHIP_STATE, MAND, row + 4, 56);
break;
case ZIP: /* Get zip code. */
step_rtn = prompt(zip, "#", L_SHIP_ZIP,
L_SHIP_ZIP, MAND, row + 4, 65);
break;
}
/* Determine next step based on return from last one. */
if (step_rtn == STEPOK) /* Was last successful? */
++step; /* Yes; go on to next step. */
else if (step_rtn == STEPBACK)
--step; /* No; back up to last step. */
}
return (step_rtn);
}